{% extends 'PrincipalBundle:Default:base.html.twig' %}
{% block title %}Editar Usuarios{% endblock %}
{% block contenido %}
<h1>Editar Usuario</h1>


<form id="form-edit" action="{{ path('usuarios_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }}>
    <input type="hidden" name="_method" value="PUT" />
        {#{{ form_widget(edit_form) }}#}
    {{ form_errors(edit_form) }}
    {{ form_row(edit_form.usuario) }}
    {{ form_row(edit_form.password) }}
    {{ form_row(edit_form.nombre) }}
    {{ form_row(edit_form.apellido) }}
    {{ form_row(edit_form.estado) }}
    {{ form_rest(edit_form) }}
</form>
<ul class="record_actions" style="margin-left: 40px;">
    <li>
        <a class="button_ok" id="guardar">
            <span>Guardar</span>
        </a>
    </li>
    <li>
        <form id="form-delete" action="{{ path('usuarios_delete', { 'id': entity.id }) }}" method="post">
            <input type="hidden" name="_method" value="POST" />
            {{ form_widget(delete_form) }}
            <a class="button_notok" id="eliminar">
                <span>Eliminar</span>
            </a>
            
        </form>
    </li>
    <li>
        <a href="{{ path('usuarios') }}" class="button_grey">
            <span>Cancelar</span>
        </a>
    </li>
    
</ul>
{% endblock %}

{% block javascripts %}
<script type="text/javascript">
    $(document).ready(function(){
        $('#guardar').click(function(){
            $('#form-edit').submit();
        });
        
        $('#eliminar').click(function(){
            $('#form-delete').submit();
        });
    });
</script>
{% endblock %}